# Base service class for all services
# This provides common functionality and patterns for service layer classes

from abc import ABC, abstractmethod
from typing import Any, Dict, List, Optional
import logging

class BaseService(ABC):
    """
    Abstract base class for all service layer classes.
    Provides common functionality and enforces service patterns.
    """
    
    def __init__(self):
        self.logger = logging.getLogger(self.__class__.__name__)
    
    def log_info(self, message: str, **kwargs):
        """Log info message with optional context"""
        self.logger.info(message, extra=kwargs)
    
    def log_error(self, message: str, exception: Exception = None, **kwargs):
        """Log error message with optional exception and context"""
        if exception:
            self.logger.error(f"{message}: {str(exception)}", extra=kwargs)
        else:
            self.logger.error(message, extra=kwargs)
    
    def log_warning(self, message: str, **kwargs):
        """Log warning message with optional context"""
        self.logger.warning(message, extra=kwargs)